package cool.webstudy.admin.constant.enums.rescode;

import lombok.extern.slf4j.Slf4j;

/**安华
 * 公告内容管理响应信息
 */
@Slf4j
public enum NoticeResCodeEnum implements BaseResCodeEnum{
    RC_ERROR_CREATE("70001","创建公告内容失败"),
    RC_ERROR_DELETE("70002","删除公告内容失败"),
    RC_ERROR_UPDATE("70003","更新公告内容失败"),
    RC_NOTICE_NOT_EXIST("70004","公告内容不存在！"),
    ;
    String code;
    String msg;
    NoticeResCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    @Override
    public String code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }

    public static NoticeResCodeEnum getMsgByCode(String code){
        for (NoticeResCodeEnum noticeResCodeEnum : NoticeResCodeEnum.values()) {
            if (noticeResCodeEnum.code().equals(code)){
                return noticeResCodeEnum;
            }
        }
        log.error("getMsgByCode 无法获取枚举值");
        return null;
    }
}
